
import 'package:floor/floor.dart';

///产品表

@entity
class ProductBean{
  @PrimaryKey(autoGenerate: true)
  int? id; //建表的时候，可为空, 就会自动生成可自增的id

  String productName  = ''; //名称
  String productCode  = ''; //code
  int number = 1; //数量 - 1
  int unitPrice = 1; //单价 2
  String allergen = ''; //过敏原 3
  int typesettingFee = 0; //排版费 4
  int printingFee = 0; //印刷费 5
  int subtotalFee = 0; //费用小计- 6
  int discount = 0; //折扣 7
  int price = 0; //价格小计 -8
  String remarks = ''; //备注，说明

  String column1 = ''; //扩展字段1
  String column2 = ''; //
  String column3 = '';
  DateTime createTime;//创建时间
  DateTime updateTime;//更新时间
  int isDelete = 0; //是否删除，0-未删除，1-删除
  ProductBean(
  {
    this.id,
    required this.productName,
    required this.productCode,
    this.number = 1,
    this.unitPrice= 1,
    this.allergen = '',
    this.typesettingFee = 0,
    this.printingFee = 0,
    this.subtotalFee = 0,
    this.discount = 0,
    this.price = 0,
    this.remarks = '',
    this.column1 = '',
    this.column2 = '',
    this.column3 = '',
    required this.createTime,
    required this.updateTime,
    this.isDelete = 0});

 Map<String, Object> toJson() {
   Map<String, Object> map = {};
   map['id'] = (id ??= -1);
   map['productName'] = productName;
   map['productCode'] = productCode;
   map['createTime'] = createTime;
   map['updateTime'] = updateTime;
   map['isDelete'] = isDelete;
   return map;
 }

}